const http = uni.$u.http


// 登录接口                                              
export const login = (params, config = {}) => http.post(`/pms/user/login?loginCode=${params.loginCode}&infoCode=${params.infoCode}&communityId=${params.communityId}&flag=1`, params, config)

//获取小区
export const getCommunity = (params={}, config = {}) => http.get(`/pms/community/list`, {params:params}, config)


//获取投票列表
export const getVoteList = (data) =>{
    // return http.get(`/pms/vote/list?communityId=${data.communityId}&pageNum=${data.pageNum}&pageSize=${data.pageSize}`)
    return http.get(`/pms/vote/list`,{params:data})
}

//
export const addApply = (data) =>{
    return http.post(`/pms/aplly/add`,data)
}
// export const addApply = (data) =>{
//     return http.post(`/pms/aplly/check`,data)
// }



export const getAreaQuery = (data) =>{
    return http.get(`/pms/area/query`,{params:data})
}

//获取房屋信息
export const getBindInfo = (data) =>{
    return http.get(`/pms/binduser/getBindInfo`,{params:data})
}

//获取房屋信息
export const getHouseList = (data) =>{
    return http.get(`/pms/house/list`,{params:data})
}

//获取投票详情
export const getVoteDetail = (data) =>{
    console.log("Data",data)
    return http.post(`/pms/vote/getVoteDetail?voteId=${data.voteId.toString()}&userId=${data.userId.toString()}&communityId=${data.communityId.toString()}`)
}


//投票
export const voteAdd = (data) =>{
    return http.post(`/pms/record/add`,data)
}
//重新投票
export const resendVoteAdd = (data) =>{
    return http.post(`/pms/record/resendVote`,data)
}

//检查投票记录
export const recordCheck = (data) =>{
    return http.post(`/pms/record/check`,data)
}


//获取证书
export const getCertificate = (data) =>{
    return http.post(`/pms/record/checkQuery`,data)
}

//获取投票详情
export const pmsVoteQuery = (data) =>{
    return http.get(`/pms/vote/${data.voteId}`)
}

//上传头像
export const pmsUserEdit = (data) =>{
    return http.put(`/pms/user/edit`,data)
}

//获取已经投票的列表
export const getVoteListByUser = (data) =>{
    return http.get(`/pms/vote/getVoteByUser`,{params:data})
}

//申请开通小区
export const addCommunityApply = (data) =>{
    return http.post(`/pms/community/apply/add`,data)
}


//查询省市区
export const getAreas = (data) =>{
    return http.get(`/system/area/getAreas`,{params:data})
}

//查询投票结果列表
export const getRecordList = (data) =>{
    return http.get(`/pms/record/list`,{params:data})
}

//查询公告
export const getNoticeList = (data) =>{
    return http.get(`/pms/notice/getNoticeList`,{params:data})
}



//公告详情
export const getNoticeDetail = (data) =>{
    return http.get(`/pms/notice/queryById`,{params:data})
}


//公告详情
export const createWxacode = (data) =>{
    return http.get(`/pms/wx/createWxacode`,{params:data})
}

//获取阅读数量
export const getReadNum = (data) =>{
    return http.get(`/pms/notice/getReadNum`,{params:data})
}


//设置阅读量
export const updateReadNum = (data) =>{
    return http.put(`/pms/notice/updateReadNum?id=${data.id}`,data)
}

//新增反馈
export const addFeedback = (data) =>{
    return http.post(`/pms/feedback/add`,data)
}


//查询详情
export const queryRecord = (data) =>{
    return http.get(`/pms/record/list`,{params:data})
}

